package com.liang.pattern;

import com.liang.pattern.store.ICommodity;
import com.liang.pattern.store.impl.CouponCommodity;
import com.liang.pattern.store.impl.GoodsCommodity;
import com.liang.pattern.store.impl.IQYCardCommodity;

/**
 * @author lsm
 * @ClassName StoreFactory.java
 * @Description TODO
 * @createTime 2023年11月29日 14:32:00
 */
public class StoreFactory {

    public static ICommodity getCommodityService(Integer commodityType){
        if (null == commodityType) {
            return null;
        }
        if (1 == commodityType){
            return new CouponCommodity();
        }
        if (2 == commodityType){
            return new GoodsCommodity();
        }
        if (3 == commodityType){
            return new IQYCardCommodity();
        }
        throw new IllegalArgumentException("不存在的服务！");
    }
}
